/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.springapplication.services;

import cz.muni.fi.pa165.springapplication.dao.CustomerManager;
import cz.muni.fi.pa165.springapplication.entities.Customer;
import cz.muni.fi.pa165.springapplication.services.CustomerService;
import cz.muni.fi.pa165.springapplication.exceptions.IllegalOrphanException;
import cz.muni.fi.pa165.springapplication.exceptions.NonexistentEntityException;
import cz.muni.fi.pa165.springapplication.exceptions.PreexistingEntityException;
import java.util.List;

/**
 *
 * @author Daniel Sák, 374560
 */
public interface CustomerService {
    
    
    /**
     * Creates new Customer in database and sets its ID
     * 
     * @param customer Customer object to be created
     * @throws IllegalOrphanException when customer id is already set
     * @throws IllegalArgumentException when customer is null
     */
    public void createCustomer(Customer customer) throws IllegalOrphanException, PreexistingEntityException;
    
    /**
     * Updates existing Customer in database
     * 
     * @param customer Customer object to be updated
     * @throws IllegalArgumentException when customer == null or some of the not-optional arguments of Customer is missing
     * @throws IllegalOrphanException when customer id == null
     * @throws NonexistentEntityException when Customer with set id doesn't exist in database
     */
    public void updateCustomer(Customer customer) throws NonexistentEntityException, IllegalOrphanException, PreexistingEntityException, Exception;
    
    /**
     * Deletes Customer from database
     * 
     * @param customer 
     * @throws IllegalArgumentException when customer == null
     * @throws IllegalOrphanException when customer id == null
     * @throws NonexistentEntityException when Customer with set id doesn't exist in database
     */
    public void deleteCustomer(Customer customer) throws NonexistentEntityException, IllegalOrphanException;
    
    /**
     * Retrieves Customer by ID
     * 
     * @param id id of the customer to be retrived
     * @return Customer object with set ID or null when customer object doesn't exist
     */
    public Customer getCustomerById(Long customerId);
    
    
    public void setCustomerManager(CustomerManager cusManager);
    
}
